/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MoreOptionsDlg.java
 *
 * Created on 2010-9-26, 11:00:34
 */
package dataanalysis.gui.moreoptiondlg;

import dataanalysis.ASMODE;
import dataanalysis.CLSMODE;
import dataanalysis.main.MainView;

/**
 *
 * @author Administrator
 */
public class MoreOptionsDlg extends javax.swing.JDialog {

    private final MainView m_manager;
    private final ASOptionPanel m_ASOptionPanel;
    private final ClsOptionPanel m_clsOptionPanel;

    /** Creates new form MoreOptionsDlg */
    public MoreOptionsDlg(java.awt.Frame parent, boolean modal, MainView manager) {
        super(parent, modal);
        initComponents();
        m_manager = manager;
        m_ASOptionPanel = new ASOptionPanel();
        m_clsOptionPanel = new ClsOptionPanel();
        m_tabbedPane.addTab("特征选择", m_ASOptionPanel);
        m_tabbedPane.addTab("分类器", m_clsOptionPanel);
        this.setTitle("更多选项");
        this.setLocationRelativeTo(parent);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        m_tabbedPane = new javax.swing.JTabbedPane();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);

        jButton1.setText("确 定");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("取 消");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(112, 112, 112)
                .addComponent(jButton1)
                .addGap(44, 44, 44)
                .addComponent(jButton2)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(20, Short.MAX_VALUE)
                .addComponent(m_tabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 359, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(21, 21, 21))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(m_tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton2)
                    .addComponent(jButton1))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        this.setVisible(false);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        ASMODE ASMode=m_ASOptionPanel.getMode();
        int ASFoldNum=m_ASOptionPanel.getFoldNum();
        int ASSeed=m_ASOptionPanel.getSeed();
        CLSMODE clsMode=m_clsOptionPanel.getMode();
        int clsFoldNum=m_clsOptionPanel.getFoldNum();
        double clsSplitPercent=m_clsOptionPanel.getPercent();
        int clsSeed=m_clsOptionPanel.getSeed();
        m_manager.setMoreOptions(ASMode,ASFoldNum,ASSeed,clsMode,clsFoldNum,clsSplitPercent,clsSeed);
        this.setVisible(false);
    }//GEN-LAST:event_jButton1ActionPerformed
//
//    /**
//     * @param args the command line arguments
//     */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//
//            public void run() {
//                MoreOptionsDlg dialog = new MoreOptionsDlg(new javax.swing.JFrame(), true);
//                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
//
//                    public void windowClosing(java.awt.event.WindowEvent e) {
//                        System.exit(0);
//                    }
//                });
//                dialog.setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JTabbedPane m_tabbedPane;
    // End of variables declaration//GEN-END:variables
}
